
    package com.yvon.grpc.api;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.ReferenceConfigBase;

import java.util.concurrent.TimeUnit;

import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;

import static com.yvon.grpc.api.CalculateServiceGrpc.getServiceDescriptor;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

@javax.annotation.Generated(
value = "by DubboGrpc generator",
comments = "Source: calculate.proto")
public final class DubboCalculateServiceGrpc {
private DubboCalculateServiceGrpc() {}

public static class DubboCalculateServiceStub implements ICalculateService {

protected URL url;
protected ReferenceConfigBase<?> referenceConfig;

protected CalculateServiceGrpc.CalculateServiceBlockingStub blockingStub;
protected CalculateServiceGrpc.CalculateServiceFutureStub futureStub;
protected CalculateServiceGrpc.CalculateServiceStub stub;

public DubboCalculateServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions, URL url, ReferenceConfigBase<?> referenceConfig) {
this.url = url;
this.referenceConfig = referenceConfig;

blockingStub = CalculateServiceGrpc.newBlockingStub(channel).build(channel, callOptions);
futureStub = CalculateServiceGrpc.newFutureStub(channel).build(channel, callOptions);
stub = CalculateServiceGrpc.newStub(channel).build(channel, callOptions);
}

    public io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Value> getResult(io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result> responseObserver) {
    return stub
    .withDeadlineAfter(url.getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS)
    .getResult(responseObserver);
    }
}

public static DubboCalculateServiceStub getDubboStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions, URL url, ReferenceConfigBase<?> referenceConfig) {
return new DubboCalculateServiceStub(channel, callOptions, url, referenceConfig);
}

public interface ICalculateService {
    public io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Value> getResult(io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result> responseObserver);

}

public static abstract class CalculateServiceImplBase implements io.grpc.BindableService, ICalculateService {

private ICalculateService proxiedImpl;

public final void setProxiedImpl(ICalculateService proxiedImpl) {
this.proxiedImpl = proxiedImpl;
}

        public io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Value> getResult(
        io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result> responseObserver) {
        return asyncUnimplementedStreamingCall(com.yvon.grpc.api.CalculateServiceGrpc.getGetResultMethod(), responseObserver);
        }

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
    .addMethod(
    com.yvon.grpc.api.CalculateServiceGrpc.getGetResultMethod(),
    asyncBidiStreamingCall(
    new MethodHandlers<
    com.yvon.grpc.api.CalculateProto.Value,
    com.yvon.grpc.api.CalculateProto.Result>(
    proxiedImpl, METHODID_GET_RESULT)))
.build();
}
}
    private static final int METHODID_GET_RESULT = 0;

private static final class MethodHandlers
<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod
<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod
<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod
<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod
<Req, Resp> {
private final ICalculateService serviceImpl;
private final int methodId;

MethodHandlers(ICalculateService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}

@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver
<Resp> responseObserver) {
    switch (methodId) {
    default:
    throw new java.lang.AssertionError();
    }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver
    <Req> invoke(io.grpc.stub.StreamObserver
        <Resp> responseObserver) {
            switch (methodId) {
                    case METHODID_GET_RESULT:
                    return (io.grpc.stub.StreamObserver
                <Req>) serviceImpl.getResult(
                    (io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result>) responseObserver);
            default:
            throw new java.lang.AssertionError();
            }
            }
            }

            }
